package com.chenjinyan.back.vo;

import lombok.Data;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * @author chenjinyan
 * @version 1.0
 */
@Data
public class BackUser implements Serializable {

    private static final long serialVersionUID = 8172210793368327271L;
    @NotNull(message = "登陆账号不能为空")
    @Size(min = 4, max = 20, message = "密码由4-20位字符组成")
    @Pattern(regexp = "^([a-zA-Z]*[0-9_-]*$)", message = "只能包含字母、数字、下划线，且不能以数字或下划线开头")
    private String username;

    @NotNull(message = "密码不能为空")
    @Size(min = 6, max = 50, message = "密码最少6位字符")
    @Pattern(regexp = "^([a-zA-Z]*[0-9_-]*$)", message = "只能包含字母、数字、下划线，且不能以数字或下划线开头")
    private String password;

    @NotNull(message = "手机号码不能为空")
    @Pattern(regexp = "^((19[0-9])|(17[0-9])|(14[0-9])|(13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$", message = "手机号码输入错误")
    private String phone;

    @Pattern(regexp = "^[A-Za-z0-9\\u4e00-\\u9fa5]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$", message = "邮箱格式不正确")
    private String email;

    @Size(max = 50, message = "姓名长度小于50位")
    private String name;

}
